<script setup>

import Dialog from "@/components/dialog/Dialog.vue";
import {onMounted, ref, watch} from "vue";

const props = defineProps({
    imageConfigDialog: {
        type: Object,
        default: () => {
            return {
                data: {

                }
            }
        }
    }
})


onMounted(() => {

})

const options = [
    {
        value: 0,
        label: '无正则模式'
    },
    {
        value: 1,
        label: 'L1正则模式'
    },
    {
        value: 2,
        label: 'L2正则模式'
    }
]

const emits = defineEmits([
    'onTraining',// 页数改变事件
])

const onTraining = () => {
    emits('onTraining')
}


</script>

<template>
    <Dialog :dialog="imageConfigDialog">
        <el-form :model="imageConfigDialog.data" label-width="auto" :label-position="'top'" style="width: 100%">
            <el-form-item label="检测窗宽度" >
                <el-input-number v-model="imageConfigDialog.data.windowWidth" :min="1"  style="width: 100%;" />
            </el-form-item>
            <el-form-item label="检测窗高度">
                <el-input-number v-model="imageConfigDialog.data.windowHeight" :min="1" style="width: 100%;" />
            </el-form-item>
            <el-form-item label="神经网络线性层，隐层神经元数量">
                <el-input-number v-model="imageConfigDialog.data.hiddenNerveNub" :min="0"  style="width: 100%;" />
            </el-form-item>
            <el-form-item label="神经网络线性层，每层学习率">
                <el-input-number v-model="imageConfigDialog.data.lineStudy" :min="0"  style="width: 100%;" />
            </el-form-item>
            <el-form-item label="神经网络卷积层，卷积核大小">
                <el-input-number v-model="imageConfigDialog.data.kernelSize" :min="0" style="width: 100%;" />
            </el-form-item>
            <el-form-item label="神经网络卷积层，每层学习率">
                <el-input-number v-model="imageConfigDialog.data.convStudy" :min="0" style="width: 100%;" />
            </el-form-item>
            <el-form-item label="训练次数，控制在 样本数量 * 训练次数 = [1000~2000]，当设置检测框越大，则需要样本数量越多">
                <el-input-number v-model="imageConfigDialog.data.enhance" :min="1" style="width: 100%;" />
            </el-form-item>
            <el-form-item label="非极大抑制值，交并比阈值">
                <el-input-number v-model="imageConfigDialog.data.iouTh" :min="0" :max="1" style="width: 100%;" />
            </el-form-item>
            <el-form-item label="检测框与检测物相交的面积若超过检测物面积的x，则认为检测框内的东西可以当目标物训练">
                <el-input-number v-model="imageConfigDialog.data.containIouTh" :min="0" :max="1" style="width: 100%;" />
            </el-form-item>
            <el-form-item label="加速线程的数量">
                <el-input-number v-model="imageConfigDialog.data.coreNumber" :min="0" style="width: 100%;" />
            </el-form-item>
            <el-form-item label="[0~1]，识别中会为每个检测框打分，当低于这个指的时候认为是不需要检测">
                <el-input-number v-model="imageConfigDialog.data.pth" :min="0" :max="1" style="width: 100%;" />
            </el-form-item>
            <el-form-item label="训练时窗口移动步长">
                <el-input-number v-model="imageConfigDialog.data.stepReduce" :min="0.1" :max="1" style="width: 100%;" />
            </el-form-item>
            <el-form-item label="检测时窗口移动步长">
                <el-input-number v-model="imageConfigDialog.data.checkStepReduce" :min="0.1" :max="1" style="width: 100%;" />
            </el-form-item>
            <el-form-item label="正则模式" >
                <el-select v-model="imageConfigDialog.data.regularModel">
                    <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                    />
                </el-select>
                <el-text v-show="imageConfigDialog.data.rzModel === 0">
                    无正则模式即不对权重施加惩罚，或者样本数据量较为大充足时，样本规律性较强，可直接使用无正则模式
                </el-text>
                <el-text v-show="imageConfigDialog.data.rzModel === 1">
                    L1正则模式，当出现异常值，或者未见过的异常噪音时，L1的鲁棒性非常强。它是以简化模型，突出重点权重的方式来增强其稳定性与鲁棒性的
                </el-text>
                <el-text v-show="imageConfigDialog.data.rzModel === 2">
                    L2正则模式，它更容易调动全部参数特征，让特征平均的落在每个权重上，误差最容易最快下降到最优解的位置上。面对形态多变且种类复杂，或者维度比较大的情况下，能获得最好的优化效果
                </el-text>
            </el-form-item>

        </el-form>
        <template #table-dialog-btn>
            <el-button type="primary" @click="onTraining">训练</el-button>
        </template>
    </Dialog>
</template>

<style scoped lang="scss">
:deep(.el-text){
    line-height: 1.2;
}
</style>